package token

import (
	"github.com/gin-gonic/gin"
	"regexp"
)

//获取token
func GetTokenFromHeader(c *gin.Context) string {
	accessToken := c.Request.Header.Get("Authorization")

	match, _ := regexp.Match(`Bearer `, []byte(accessToken))
	if match {
		return string([]rune(accessToken)[len(`Bearer `):])
	}

	return ""
}
